﻿using System;
using System.Collections.Generic;
using System.Diagnostics;

namespace Affinity.Core.Validation
{
    public static class DebugAssert
    {
        [Conditional("DEBUG")]
        public static void ArgumentNotEmpty<T>(IEnumerable<T> value, string valueName, string customMessage = null)
        {
            Assert.ArgumentNotEmpty<T>(value, valueName, customMessage);
        }
        
        [Conditional("DEBUG")]
        public static void ArgumentNotNull<T>(T value, string valueName, string customMessage = null)
            where T : class
        {
            Assert.ArgumentNotNull<T>(value, valueName, customMessage);
        }
        
        [Conditional("DEBUG")]
        public static void ArgumentNotNull<T>(T? value, string valueName, string customMessage = null)
            where T : struct
        {
            Assert.ArgumentNotNull<T>(value, valueName, customMessage);
        }
        
        [Conditional("DEBUG")]
        public static void IsFalse(bool value, string failureMessage)
        {
            Assert.IsFalse(value, failureMessage);
        }
        
        [Conditional("DEBUG")]
        public static void IsTrue(bool value, string failureMessage)
        {
            Assert.IsTrue(value, failureMessage);
        }
        
        [Conditional("DEBUG")]
        public static void IsType<T>(object value, string valueName, bool allowNull = false, string customMessage = null)
        {
            Assert.IsType<T>(value, valueName, allowNull, customMessage);
        }
        
        [Conditional("DEBUG")]
        public static void NotEmpty<T>(IEnumerable<T> value, string valueName, string customMessage = null)
        {
            Assert.NotEmpty<T>(value, valueName, customMessage);
        }
        
        [Conditional("DEBUG")]
        public static void NotEmpty(Guid value, string valueName, string customMessage = null)
        {
            Assert.NotEmpty(value, valueName, customMessage);
        }
        
        [Conditional("DEBUG")]
        public static void NotNull<T>(T value, string valueName, string customMessage = null)
            where T : class
        {
            Assert.NotNull<T>(value, valueName, customMessage); 
        }
        
        [Conditional("DEBUG")]
        public static void NotNull<T>(T? value, string valueName, string customMessage = null)
            where T : struct
        {
            Assert.NotNull<T>(value, valueName, customMessage);
        }
    }
}
